home *** CD-ROM | disk | FTP | other *** search
/ Amiga Game-Power / Amiga Game-Power.iso / power games ii / tetrix / uedit / config!r < prev    next >
Text File  |  1994-05-20  |  7KB  |  191 lines

  1. ======= AREXX CMDS ======
  2.  
  3. Edit Rexx output buffer 35
  4. <altCtl-1:
  5.     equateLoc(buf35,sPage,sFile)
  6.     editBuf(buf35) >
  7.  
  8. Edit Rexx input buffer 36
  9. <altCtl-2:
  10.     equateLoc(buf36,sPage,sFile)
  11.     editBuf(buf36) >
  12.  
  13. Send output buffer 35 to Rexx
  14. <altCtl-3:
  15.     equateNum(n98,0)                     .. 0 flag means send msg, not reply
  16.     rexxOut(buf35,all,0,n98,n99)   .. 0 ActionResult means default to RXCOMM
  17.     runKey(virtual-s) >
  18.  
  19. Fetch Rexx input into buffer 36
  20. <altCtl-4:
  21.     if (rexxIn(buf36,sFile,n97,n98,n99)) if (eqNum(n98,0)) {       .. if Msg
  22.         equateLoc(buf36,sPage,sFile)
  23.         editBuf(buf36)
  24.     }
  25.     runKey(virtual-r) >
  26.  
  27. Send hilite region to Rexx.
  28. <altCtl-5:
  29.     equateNum(n98,0)                               .. 0 means msg, not reply
  30.     rexxOut(curFile,hilite,0,n98,n99)  .. 0 means default to Action = RXCOMM
  31.     runKey(virtual-s) >
  32.  
  33. Fetch Rexx input at cursor
  34. <altCtl-6:
  35.     rexxIn(curFile,atCursor,n97,n98,n99)
  36.     runKey(virtual-r) >
  37.  
  38. Send an OK reply to Rexx  (NOTE: Amiga-ESC abort sends Failed reply.)
  39. <altCtl-7:
  40.     equateNum(n98,1)                               .. 1 means reply, not msg
  41.     rexxOut(" ",all,0,n98,n99)                           .. 0 is OKAY result
  42.     runKey(virtual-s) >
  43.  
  44. Send an OK reply to Rexx along with text in hilite region
  45. <altCtl-8:
  46.     equateNum(n98,1)
  47.     rexxOut(curFile,hilite,0,n98,n99) ..text NOT sent, if not RXFB_RESULT msg
  48.     runKey(virtual-s) >
  49.  
  50. Toggle flag to handle Rexx traffic automatically during idle periods.
  51. <altCtl-9:
  52.                                            .. set idletime back to old value
  53.     if (getFlag(curFile,userGlobalB)) equateNum(idleTime,n36)
  54.     else {                .. idleTime not 0, toggle to auto-traffic handling
  55.         equateNum(n36,idleTime)                     .. store idleTime in n36
  56.         equateNum(idleTime,0)                           .. set idleTime to 0
  57.     }
  58.     flipFlag(curFile,userGlobalB)                             .. toggle flag
  59.     swapKey(idle,virtual-t)         .. swap in/out the auto-traffic idle cmd
  60. >
  61.  
  62. Make an x.rexx program with commands to send to Uedit.
  63. <altCtl-0:
  64.     if (not newFile) return
  65.     clearRgn(curFile,all)
  66.     insertRgn(curFile,atCursor,"/* ARexx->Uedit cmd program */
  67. address 'URexx' 'c:'
  68. ",all)
  69.     movecursor(curFile,sChar)
  70.     movecursor(curFile,sChar)
  71.     equateLoc(curFile,sPage,sFile)
  72.     setFileName(curFile,"x.rexx")
  73.     updateDisplay
  74.     while (nothing) {
  75.         putMsg("Give desired inputs.  Amiga-ESC when done.  F2 to save.")
  76.         getKeyVal(macroNum,inputChar)
  77.         toWord(curFile,macroNum)
  78.         insertChar(curFile,"+")
  79.         toWord(curFile,inputChar)
  80.         insertChar(curFile," ")
  81.         updateDisplay
  82.         fileSize(curFile,n54) .. force pack, avoid mem-abort
  83.     }
  84. >
  85.  
  86. Swapped to idle for auto handling of Rexx msgs
  87. <virtual-t:
  88.     if (rexxIn(buf36,eFile,n97,n98,n99)) {           .. if fetched something
  89.         .. runKey(virtual-r)         .. show flags - slower if use this line
  90.         if (eqNum(n98,0)) {                   .. if recvd a Msg, not a Reply
  91.             moveCursor(buf36,sFile)
  92.             copyChar(buf36,n53)
  93.             moveCursor(buf36,eChar)
  94.             copyChar(buf36,n54)
  95.             moveCursor(buf36,eChar)
  96.             if (eqNum(n54,":")) {                   .. look for "c:" or "f:"
  97.                 if (eqNum(n53,"F")) goto label(10)
  98.                 if (eqNum(n53,"f"))  {
  99. label(10)                                               .. load in a FILENAME
  100.                     moveCursor(buf36,sFile)
  101.                     clearChar(buf36)
  102.                     clearChar(buf36)
  103.                     if (loadFile(buf36)) goto label(50)        .. OKAY Reply
  104.                     goto label(40)                            .. ERROR reply
  105.                 }
  106.                 if (eqNum(n53,"C")) goto label(20)
  107.                 if (eqNum(n53,"c")) {                     .. CMDs to execute
  108.                     equateNum(n54,0)                   .. use as toggle flag
  109.                     goto label(25)
  110. label(20)
  111.                     moveCursor(buf36,eWord)
  112. label(25)
  113.                     while (nothing) {
  114.                         if (is(buf36,digit)) goto label(30)
  115.                         if (is(buf36,eFile)) goto label(50) .. send OK reply
  116.                         moveCursor(buf36,eChar)
  117.                     }
  118. label(30)
  119.                     incNum(n54)
  120.                     if (not and(n54,n54,1)) {            .. must be second #
  121.                         toNumber(inputChar,buf36)
  122.                         if (inUse(macroNum)) runKey(macroNum)
  123.                         else if (gtNum(inputChar,0)) typeChar(inputChar)
  124.                     } else toNumber(macroNum,buf36)
  125.                     goto label(20)                        .. get next number
  126.                 }
  127.             }
  128.             ..
  129.             .. there was no "c:" or "f:" prefix, so must be inserting text.
  130.             .. NOTE:  For greater protection and control, you might want to
  131.             .. require an "i:" prefix for text to be inserted.
  132.             ..
  133.             if (insertRgn(curFile,atCursor,buf36,all)) goto label(50)
  134. label(40)
  135.             equateNum(n96,10)                            .. send ERROR reply
  136.             goto label(60)
  137. label(50)
  138.             equateNum(n96,0)                              .. send OKAY reply
  139. label(60)
  140.             freeBuf(buf36)
  141.             rexxOut(" ",all,n96,1,n99)             .. send REPLY code in n96
  142.         }
  143.     }
  144. >
  145.  
  146. Show numbers for a received Arexx msg or reply
  147. <virtual-r:
  148.         if (not eqNum(n99,0)) runKey(virtual-m)           .. rexxIn() failed
  149.         else {                                         .. rexxIn() succeeded
  150.             if (eqNum(n98,0)) {              .. MSG: show action & modifiers
  151.                 and(n96,n97,251658240)                    .. get ACTION code
  152.                 and(n95,n97,31)                              .. get MODIFIER
  153.                 freeBuf(buf54)
  154.                 insertRgn(buf54,atCursor,"Msg fetched:  Action = ",all)
  155.                 toWord(buf54,n96)
  156.                 insertRgn(buf54,atCursor,"  Modifier = ",all)
  157.                 toWord(buf54,n95)
  158.                 putMsg(buf54)
  159.             } else {                                              .. REPLY:
  160.                 if (eqNum(n97,0)) putMsg("Reply fetched.  Result OKAY")
  161.                 else {
  162.                     freeBuf(buf54)
  163.                     insertRgn(buf54,atCursor,
  164.                         "Reply received:  Result = ERROR ",all)
  165.                     toWord(buf54,n97)
  166.                     putMsg(buf54)
  167.                 }
  168.             }
  169.         }
  170. >
  171.  
  172. Show numbers for a sent ARexx msg or reply
  173. <virtual-s:
  174.         if (not eqNum(n99,0)) runKey(virtual-m)          .. rexxOut() failed
  175.         else {
  176.             if (eqNum(n98,0)) putMsg("Msg sent")
  177.             else              putMsg("Reply sent")
  178.         }
  179. >
  180.  
  181. Show returncode error msgs
  182. <virtual-m:
  183.     if (eqNum(n99,-1)) putMsg("ARexx not up")
  184.     if (eqNum(n99,-2)) putMsg("No memory or no text")
  185.     if (eqNum(n99,-3)) putMsg("Msg/reply > 65535 bytes")
  186.     if (eqNum(n99,-4)) putMsg("Nothing to fetch or reply to")
  187.     if (eqNum(n99,-5)) putMsg("Fetch reply before sending this msg/reply")
  188.     returnFalse                   .. so virtual-r/-s above will return False
  189. >
  190.  
  191.